package cn.wzc.crystal.platform.golbal;

import lombok.Getter;

/**
 * 全局异常
 * 出现此异常表示: 程序员不知道发生了什么/系统拦截到了什么全局异常,总之不在控制范围之内
 */
@Getter
public class GlobalException extends RuntimeException {

	private GlobalException(String message) {
		super(message);
	}

	private GlobalException(Throwable cause) {
		super(cause);
	}


	private GlobalException(String message, Throwable cause) {
		super(message, cause);
	}

	/**
	 * create with message
	 *
	 * @param message is exception message
	 */
	public static GlobalException from(String message) {
		return new GlobalException(message);
	}


	/**
	 * create with cause
	 *
	 * @param cause is exception cause
	 */
	public static GlobalException from(Throwable cause) {
		return new GlobalException(cause);
	}

	/**
	 * create with message and cause
	 *
	 * @param message is exception message
	 * @param cause   is exception cause
	 */
	public static GlobalException from(String message, Throwable cause) {
		return new GlobalException(message, cause);
	}


}
